
<style type="text/css">
	.hasDtail {cursor: pointer;color:#b15d08}
	.inputDiv {
		
	    font-weight: bold;
	    text-align: right;
	    color: #03142e;
	    line-height: 24px;
	    padding: 5px;
	    word-break: keep-all;
	    display: inline-block;}
	.titleDiv {background: #fff; font-size: 17px; font-weight: normal;}
</style>
<p-panel header="{{ 'txt.DataImportZone' | i18n}}" [toggleable]="true">
		<table cellspacing="0" cellpadding="0" class="tabframe1">
			<tr>
				<th>{{ 'txt.ChooseDataFile' | i18n}}：</th>
				<td><i-file-upload [fileUploadInfo]="dataFileUploadInfo">Uploader here...</i-file-upload></td>
				<th title="{{ 'txt.FullOrIncExplain' | i18n}}">{{ 'txt.ImportMode' | i18n}}：</th>
				<td>
				{{ 'txt.IncreasementMode' | i18n}}<p-radioButton name="ImportMode" value="true" [disabled]="!isApprover" [(ngModel)]="newDataImport.increasement"></p-radioButton>
				{{ 'txt.WholeMode' | i18n}}<p-radioButton name="ImportMode" value="false" [disabled]="!isApprover" [(ngModel)]="newDataImport.increasement"></p-radioButton>
				</td>
			</tr>
			<tr>
				<th>{{ 'txt.ImportMemo' | i18n}}<font color="red">*</font>：</th>
				<td><input type="text" #impMemo required [(ngModel)]="newDataImport.memo" pInputText/> </td>
				<th>{{ 'txt.OverrideDuplication' | i18n}}：</th>
				<td><p-checkbox name="overrideDuplication" #overdup value="true"  [disabled]="!isApprover"  [(ngModel)]="newDataImport.overrideDuplication"></p-checkbox>
				</td>
			</tr>
			<tr>
				<th>{{ 'txt.ImportCleanScope' | i18n}}：</th>
				<td colspan="2"><input [(ngModel)]="newDataImport.cleanDataClause" type="text" pInputText [disabled]="! newDataImport.increasement || !isApprover"
					placeholder="{{ 'txt.ImportCleanClause' | i18n}}" size="120"/></td>
				<td>
					<div align="right">
						<p-button (click)="importData()" label="{{ 'txt.ImportData' | i18n}}"></p-button>
					</div>
				</td>
			</tr>
		</table>
</p-panel>
<!-- 数据导入历史列表 -->
<p-panel header="{{ 'txt.dataImportHistory' | i18n}}">
	<p-dropdown [options]="ietables" placeholder="{{ 'txt.All' | i18n}}" [(ngModel)]="selectedTable" dataKey="code" optionLabel="name" (onChange)="getDataImports()" showClear="true"></p-dropdown>
		<!-- @sec.authorize url='/iisp-data-ie/imports/approve.htm.POST'--> 
		<div class="titleDiv inputDiv">{{ 'upload.node.code' | i18n}}</div>
		<div class="inputDiv">
		<p-dropdown [options]="nodes" [(ngModel)]="queryParam.nodeCode"  placeholder="{{ 'txt.All' | i18n}}" [showClear]="true"></p-dropdown>
		</div>
		<div class="titleDiv inputDiv">{{ 'txt.DataDate' | i18n}}</div>
		<div class="inputDiv">
		<input type="text" size="8" [(ngModel)]="queryParam.dataDate" pInputText />
		</div>
		<!-- /@sec.authorize -->
		<div class="titleDiv inputDiv">{{ 'txt.ImportState' | i18n}}
		<p-dropdown [options]="states" [(ngModel)]="queryParam.state" placeholder="{{ 'txt.All' | i18n}}" [showClear]="true"></p-dropdown>
			</div>
		<div class="titleDiv inputDiv">{{ 'txt.importDate' | i18n}}</div>
		<div class="inputDiv">
	<p-calendar [(ngModel)]="queryParam.fromDate" dateFormat="yy-mm-dd" [locale]="calLang" ></p-calendar> -
	<p-calendar [(ngModel)]="queryParam.toDate" dateFormat="yy-mm-dd" [locale]="calLang"></p-calendar>
		</div>
		<div class="inputDiv">
			<p-button (click)="getDataImports()" label="{{ 'txt.filter' | i18n}}"></p-button>
		</div>
	<p-table [value]="dataImports.datas" [lazy]="true" (onLazyLoad)="getDataImports($event)" [paginator]="true" [rows]="queryParam.pageSize" [totalRecords]="dataImports.recordCount">
		<ng-template pTemplate="caption"> {{ "txt.dataImportHistory" | i18n }} </ng-template>
	    <ng-template pTemplate="header">
			<tr>
				<th>{{ 'txt.TableName' | i18n}}</th>
				<th>{{ 'txt.Uploader' | i18n}}</th>
				<th>{{ 'txt.NodeName' | i18n}}</th>
				<th>{{ 'txt.DataDate' | i18n}}</th>
				<th>{{ 'txt.UploadTime' | i18n}}</th>
				<th>{{ 'txt.ImportMemo' | i18n}}</th>
				<th>{{ 'txt.ImportState' | i18n}}</th>
				<th style="width:160px;">{{ 'txt.ImportMessage' | i18n}}</th>
				<th>{{ 'txt.ImportedDataFile' | i18n}}</th>
			</tr>
	    </ng-template>
		<ng-template pTemplate="body" let-imp>
			<tr>
				<td title='{{imp.tableName}}' [ngClass]="{'hasDtail': imp.actions && imp.actions.length > 0}" (click)="imp.actions && imp.actions.length > 0 ? showDetail(imp) : ''">{{imp.tableDesc}}</td>
				<td>{{imp.createUser}}</td>
				<td>{{imp.nodeName}}</td>
				<td>{{imp.dataDate}}</td>
				<td>{{imp.createTime.getFullYear()}}-{{imp.createTime.getMonth()+1}}-{{imp.createTime.getDate()}} {{imp.createTime.getHours()}}:{{imp.createTime.getMinutes()<10?'0'+imp.createTime.getMinutes():imp.createTime.getMinutes()}}</td>
				<td style="width:260px;">{{imp.memo}}</td>
				<td>{{resolveState(imp.importState)}}</td>
				<td style="width:160px;" title="{{getImportResultStatistics(imp)}}"><p style="width:160px;overflow:hidden; white-space:nowrap;text-overflow:ellipsis;">{{getImportResultStatistics(imp)}}</p></td>
				<td style="width:40px;"><a href="${fileDownloadRoot}{{imp.fileUri}}" target="_blank">{{ 'txt.download' | i18n}}</a></td>
			</tr>
		</ng-template>
	</p-table>
</p-panel>
<i-mbox [isRunning]="isRunning()"></i-mbox>
<p-dialog header="<@sp.message code='txt.DataImportDtl'/>" [(visible)]="dtlWindowOpened" modal="modal">
	<div *ngIf="selectedDataImport">
		<div>
		<table class="resultTable">
		<caption><@sp.message code='txt.ActionHistory'/></caption>
			<thead>
				<tr>
					<th>{{ 'txt.OperatTime' | i18n}}</th>
					<th>{{ 'txt.Operator' | i18n}}</th>
					<th>{{ 'txt.Action' | i18n}}</th>
					<th>{{ 'txt.Message' | i18n}}</th>
				</tr>
			</thead>
			<tbody>
				<tr *ngFor="let impAct of selectedDataImport.actions" >
					<td>{{impAct.createTime.getFullYear()}}-{{impAct.createTime.getMonth()+1}}-{{impAct.createTime.getDate()}} {{impAct.createTime.getHours()}}:{{impAct.createTime.getMinutes()<10?'0'+impAct.createTime.getMinutes():impAct.createTime.getMinutes()}}</td>
					<!--<td>{{impAct.createTime  | date:'yyyy-MM-dd HH:mm'}}</td>-->
					<td>{{impAct.createUser}}</td>
					<td>{{resolveAction(impAct.action)}}</td>
					<td>{{impAct.message}}</td>
				</tr>
			</tbody>
		</table>
		</div>
		<div *ngIf="selectedDataImport.importState == 'DRAFT'">
		<div>{{ 'txt.ActionMemo' | i18n}}<textarea [(ngModel)]="currentAction.message" rows="3" style="width: 98%;" > </textarea></div>
<!-- <@sec.authorize url='/iisp-data-ie/imports/approve.htm.POST'> --> 
		<div style="width: 98%; text-align: right;">
			<p-button (click)="approveImport()" label="{{ 'txt.Approve' | i18n}}"></p-button>
			<p-button (click)="rejectImport()" label="{{ 'txt.Reject' | i18n}}"></p-button>
		</div>
<!-- </@sec.authorize> -->
		</div>
	</div>
</p-dialog>
